#!/bin/bash
set -e
export LANG=zh_CN.UTF-8
export JAVA_HOME=/usr
#获取shell脚本的绝对路径
WEB_ROOT=$(cd `dirname $0`; pwd)
export WEB_ROOT

export LOG_BASE=${WEB_ROOT}/logs
mkdir -p ${LOG_BASE}

CLASSPATH=${WEB_ROOT}/WEB-INF/classes
for i in ${WEB_ROOT}/WEB-INF/lib/*
do
CLASSPATH=${CLASSPATH}:${i}
done
export CLASSPATH

source ${WEB_ROOT}/WEB-INF/classes/boot.ini
export JVM_ARGS
export JVM_GC
export JVM_HEAP
export JVM_SIZE

JVM_DUMP="-Xloggc:${LOG_BASE}/app.gc.log -XX:ErrorFile=${LOG_BASE}/app.vmerr.log -XX:HeapDumpPath=${LOG_BASE}/app.heaperr.log"
JETTY_ARGS="-Djetty.webroot=${WEB_ROOT} -Djetty.logs=${LOG_BASE}"
export JVM_DUMP
export JETTY_ARGS

nohup ${JAVA_HOME}/bin/java ${JVM_ARGS} ${JVM_GC} ${JVM_HEAP} ${JVM_SIZE} ${JVM_DUMP} ${JETTY_ARGS} com.ifish.boot.JettyBoot > ${LOG_BASE}/boot.log 2>&1 &
pid=$!
echo '$pid'